import { useState } from 'react';

// 1.封装组件, 组件内封装逻辑
export function LogMouse({ render }) {
  const [mouse, setMouse] = useState({ x: 0, y: 0 });
  const handleMouseMove = (e) => {
    setMouse({ x: e.clientX, y: e.clientY });
  };

  // 2. 接收一个函数,  调用函数
  return render({ mouse, handleMouseMove });
}
